package com.crazyteam.genid.thread;

import com.crazyteam.genid.model.KeyInfo;
import com.crazyteam.genid.service.PrimaryKeyService;
import org.springframework.scheduling.annotation.Async;

public class ExpandTask {
    private PrimaryKeyService primaryKeyService;
    private final KeyInfo keyInfo;

    public ExpandTask(PrimaryKeyService primaryKeyService, final KeyInfo keyInfo){
        this.primaryKeyService = primaryKeyService;
        this.keyInfo = keyInfo;
    }
    @Async
    public void syncExpandKey(){

        primaryKeyService.syncExpandKey(keyInfo);
    }
    @Async
    public void syncExpandPreKey(){
        primaryKeyService.loadPrepBuff(keyInfo);
    }
}
